package com.pomr.util.communication.cx217;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSONObject;
import com.pomr.util.communication.Communication;
import com.pomr.util.communication.cx215.CX215Back;

/**
 * 
 * 类名称： CX217Back
 * 创建人： Administrator
 * 创建时间：2018年5月8日 下午2:14:10
 * 类描述：近6个月账单 出参
 */
public class CX217Back implements Communication,Serializable{
	public List<CX217BackBase> getBeforeSixMonthData() {
		return beforeSixMonthData;
	}
	public void setBeforeSixMonthData(List<CX217BackBase> beforeSixMonthData) {
		this.beforeSixMonthData = beforeSixMonthData;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getCodeName() {
		return codeName;
	}
	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}
	
	private int code;//查询状态
	private String codeName;
	private List<CX217BackBase> beforeSixMonthData;//过去6个月数据 数组
	
	public static Object fromJson(String jsonStr) {
//		jsonStr = "{"+
//			"'beforeSixMonthData': ["+
//			"{"+
//			"'msmUseCount': 0,"+
//			"'rechMoney': 0,"+
//			"'rechNum': 0,"+
//			"'useData': 120,"+
//			"'yearMonth': '2016-11'"+
//			"},"+
//			"{"+
//			"'msmUseCount': 20,"+
//			"'rechMoney': 0,"+
//			"'rechNum': 0,"+
//			"'useData': 0,"+
//			"'yearMonth': '2016-12'"+
//			"}"+
//			"],"+
//			"'code': 0"+
//"}";
		CX217Back back = (CX217Back)JSONObject.parseObject(jsonStr, CX217Back.class);
		//查询状态
		if(back.getCode() == 0){
			back.setCodeName("查询正常");
		}else if(back.getCode() == 1){
			back.setCodeName("appid、secret、sign有误");
		}else if(back.getCode() == 2){
			back.setCodeName("imsi、iccid、msisdn有误");
		}else if(back.getCode() == 9999){
			back.setCodeName("意外错误");
		}
		return back;
	}

}
